﻿<Page
    x:Class="PPCalc.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    xmlns:conv="using:PPCalc.Converters"
    DataContext="{StaticResource MainViewModel}">
    <Page.Resources>
        <conv:DecimalConverter x:Key="DecimalConverter" />
        <conv:PointsConverter x:Key="Pointsconverter" />
    </Page.Resources>
    <Page.BottomAppBar>
        <AppBar>
            <Grid>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                    <Button Style="{StaticResource DeleteAppBarButtonStyle}" Command="{Binding InitCommand}"/>
                </StackPanel>
            </Grid>
        </AppBar>
    </Page.BottomAppBar>
    <StackPanel Orientation="Vertical" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <StackPanel Orientation="Horizontal">
            <Image Source="Assets/Logo.png" Width="50" Margin="10" />
            <StackPanel Orientation="Vertical">
                <TextBlock Text="PPCalc" FontSize="50" VerticalAlignment="Center" />
                <TextBlock x:Uid="Subtitle" Text="ProPoints points calculator" />
            </StackPanel>
        </StackPanel>
        <Grid>
            <TextBlock x:Uid="Protein" Text="Protein" HorizontalAlignment="Left" Margin="11,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" />
            <TextBox Margin="10,23,10,0" TextWrapping="Wrap" Text="{Binding Points.Protein, Converter={StaticResource DecimalConverter}, Mode=TwoWay}" VerticalAlignment="Top" GotFocus="TextBoxGotFocus"/>
            <TextBlock x:Uid="Fat" HorizontalAlignment="Left" Margin="10,61,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Text="Fat" />
            <TextBox Margin="10,74,10,0" TextWrapping="Wrap" Text="{Binding Points.Fat, Converter={StaticResource DecimalConverter}, Mode=TwoWay}" VerticalAlignment="Top" GotFocus="TextBoxGotFocus"/>
            <TextBlock x:Uid="Carbohydrates" HorizontalAlignment="Left" Margin="10,111,0,0" TextWrapping="Wrap" Text="Carbohydrates" VerticalAlignment="Top"/>
            <TextBox Margin="10,124,10,0" TextWrapping="Wrap" Text="{Binding Points.Carbohydrates, Converter={StaticResource DecimalConverter}, Mode=TwoWay}" VerticalAlignment="Top" GotFocus="TextBoxGotFocus"/>
            <TextBlock x:Uid="Fibre" HorizontalAlignment="Left" Margin="10,161,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Text="Fibre" />
            <TextBox Margin="10,174,10,0" TextWrapping="Wrap" Text="{Binding Points.Fibre, Converter={StaticResource DecimalConverter}, Mode=TwoWay}" VerticalAlignment="Top" GotFocus="TextBoxGotFocus"/>
            <TextBlock HorizontalAlignment="Left" Margin="10,211,0,0" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="25" Text="{Binding Points.Points,Converter={StaticResource Pointsconverter}, Mode=OneWay}"/>
        </Grid>
    </StackPanel>
</Page>
